import React from 'react';
import { useAuth } from "context/auth-context";
import { Form, Button, Input, Card } from 'antd';

export const RegisterView = () => {
    const { register } = useAuth()

    const handleSubmit = (value: any) => {
        console.log(value)
        register(value)
    }

    return  <Form onFinish={handleSubmit}>
                <Form.Item
                    label="username"
                    name={'username'}
                    rules={[{ required: true, message: '请输入用户名!' }]}>
                    <Input />
                </Form.Item>
                <Form.Item
                    label="password"
                    name={'password'}
                    rules={[{ required: true, message: '请输入密码!' }]}>
                    <Input.Password />
                </Form.Item>
                <Form.Item>
                    <Button type="primary" htmlType="submit">注册</Button>
                </Form.Item>
            </Form>
}
